/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package domain;

import java.util.List;
import java.util.Observable;
import java.util.Observer;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Jasper
 */
public class TableModel extends AbstractTableModel implements Observer{
    private final String[] columnNames = {"Naam","Score"};
    private List<Client> clients;
    

    @Override
    public int getRowCount() {
        return clients.size();
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    
    
    @Override
    public Object getValueAt(int row, int column) {
        //player ophalen
        Client c = clients.get(row);

        
        //veldje teruggeven
        switch(column){
            case 0: return c.getNaam();
            case 1: return c.getScore();
            default: throw new IllegalArgumentException();
        }
    }
    
    public TableModel(List<Client> clients) {
        this.clients = clients;
    }

    @Override
    public void update(Observable o, Object arg) {
        fireTableDataChanged();
    }
    
    
}
